#!/usr/bin/env python3

import rospy

from plumbing_server_client.srv import (Multiply, MultiplyRequest,
                                        MultiplyResponse)


def do_req(req: MultiplyRequest):
    res = req.num1 * req.num2
    rospy.loginfo('got data: %d x %d = %d', req.num1, req.num2, res)
    resp = MultiplyResponse(res)
    resp.sum = res
    return resp


if __name__ == '__main__':
    rospy.init_node('MulService')
    server = rospy.Service('MultiPly', Multiply, do_req)
    rospy.spin()
